package com.linchong.helloworld.Controller;

import com.linchong.helloworld.entity.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @BelongsProject:springboothelloworld
 * @BelongsPackage:com.linchong.helloworld
 * @Author:linchong
 * @CreateTime:2018-08-11 19:39
 * @Description:SpringBoot之Helloworld
 */


@RestController
public class HelloController {
    /**
     * 建立请求映射
     * @return
     */
    @RequestMapping("/hello")
    public  String hello(){
        return "hellos";
    }

    /**
     * SpringBoot返回实体类对象数据
     * 默认使用的json解析框架是jackson
     * @return
     */
    @RequestMapping("/getUser")
    public User getUesr(){
        User user = new User();
        user.setId(001);
        user.setName("张三");
        user.setCreateTime(new Date());
        user.setRemarks("添加备注信息");
        return user;
    }
}
